<template>
  <div class="make-up">
    <!-- 护肤榜商品列表渲染 -->
    <div class="cart-list">
      <ul>
        <li
          v-for="item in cartList"
          :key="item._id"
          @click="gotoDetail(item._id)"
        >
          <img :src="item.imgUrl" alt="" />
          <div class="cart-details">
            <h2>{{ item.engTitle }}</h2>
            <span>{{ item.score }}</span>
            <van-rate
              v-model="item.star"
              :size="14"
              color="#68dcdc"
              void-icon="star"
              void-color="#eee"
            />
            <i>({{ item.number }}评分)</i>
            <p>{{ item.place }}·{{ item.price }}/{{ item.effect }}</p>
          </div>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
import { getListApi } from "@/utils/api";
export default {
  data() {
    return {
      cartList: [],
    };
  },
  mounted() {
    this.getListData();
  },
  methods: {
    //点击跳转详情页
    gotoDetail(_id) {
      this.$router.push("/detail/" + _id);
    },
    //获取列表数据
    async getListData() {
      const res = await getListApi();
      this.cartList = res;
    },
  },
};
</script>

<style lang="less" scoped>
.make-up {
  width: 100%;
  position: relative;
  .cart-list {
    overflow: auto;
    height: 1300px;
    li {
      width: 100%;
      height: 120px;
      border-bottom: 1px solid #e6e6e6;
      display: flex;
      img {
        width: 100px;
        height: 100px;
      }
      .cart-details {
        flex-direction: column;
        h2 {
          margin-top: 20px;
          width: 180px;
          height: 20px;
          font-size: 15px;
          font-family: PingFang;
          font-weight: bold;
          color: #333333;
          overflow: hidden;
          white-space: nowrap;
          text-overflow: ellipsis;
        }
        p {
          width: 120px;
          height: 12px;
          font-size: 12px;
          font-family: PingFang;
          font-weight: bold;
          color: #999999;
          padding-top: 10px;
        }
        span {
          width: 18px;
          height: 12px;
          font-size: 16px;
          font-family: DIN;
          font-weight: bold;
          color: #68dcdc;
          margin-right: 10px;
        }
        i {
          width: 80px;
          height: 13px;
          font-size: 14px;
          font-family: SimSun;
          font-weight: bold;
          color: #666666;
          margin-left: 10px;
        }
      }
    }
  }
}
</style>
